package org.wattdepot.cli.command;

import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import static org.junit.Assert.assertTrue;

/**
 * Test case for chart command, checks if a file was written and any errors in the arguments
 * entered.
 * 
 * @author Edward Meyer, Bao Huy Ung
 * 
 */
public class TestChartCommand {

  /**
   * Tests if a file was created from valid arguments.
   */
  @Test
  public void testWrote() {

    List<String> args = new ArrayList<String>();
    args.add("chart");
    args.add("power");
    args.add("generated");
    args.add("SIM_WAIAU_5");
    args.add("2009-11-06");
    args.add("2009-11-10");
    args.add("sampling-interval");
    args.add("30");
    args.add("file");
    args.add("test.html");

    ChartCommand testCC = new ChartCommand();
    String testOut = testCC.doCommand(args);

    System.out.println("Testing ChartCommand's write capabilities...");
    assertTrue("Testing if ChartCommand wrote to file.", testOut.contains("Wrote")
        && testOut.contains("test.html"));

  }
}
